<template>
  <view class="container">
    <!-- <view v-if="promotion.promotionId" class="promotion_box">
            <view class="flex">
                <view :class="{selectTab:!tabIndex}" class="tab" @tap="tabIndex = 0">活动商品列表</view>
                <view :class="{selectTab:tabIndex}" class="tab"  @tap="tabIndex = 1">赠品列表</view>
                <view  class="promotion_name flex a-item fl1">
                    {{ promotion.promotionName }}
                </view>
            </view>
            <view class="giveCount flex a-item">
                可赠送数量{{ giveCount || 0 }}
            </view>
            <view class="promotion_container" v-show="!tabIndex">
                <view v-for="item in promotionGoodsList"
                      :class="{curGoods:item === curGoods}"
                      @tap="setCurGoods(item)"
                      class="activity_goods flex">
                    <view class="goods_name">{{ item.goodsName }}</view>
                    <view class="goods_num">{{ item.boxNum || 0}}{{ item.boxUnitName }}{{ item.mainNum || 0 }}{{ item.mainUnitName }}</view>
                </view >
            </view>
            <view class="promotion_container" v-show="tabIndex">
                <view v-for="item in giftList"
                      :class="{curGoods:item === curGoods}"
                      @tap="setCurGoods(item)"
                      class="activity_goods flex">
                    <view class="goods_name">{{ item.goodsName }}</view>
                    <view class="goods_num">{{ item.boxNum || 0}}{{ item.boxUnitName }}{{ item.mainNum || 0 }}{{ item.mainUnitName }}</view>
                </view >
            </view>
        </view> -->
    <view class="goods_main">
      <view class="goods_title flex">
        <view class="img_box">
          <img :src="curGoods.image" alt="" />
        </view>
        <view class="goods_info">
          <view class="goodsName">{{ curGoods.goodsName }}</view>
          <view class="box_price">单价：￥{{ curGoods.taxPrice }}</view>
          <view class="box_price">箱价：￥{{ curGoods.taxBoxPrice }}</view>
          <!-- <view class="box_price">{{ curGoods.mainUnitCount }}{{ curGoods.boxUnitName }}={{ curGoods.boxUnitCount }}{{ curGoods.mainUnitName }}</view> -->
        </view>
      </view>
      <view class="goods_amount_box flex">
        <view class="fl2">
          <view class="th">数量</view>
          <view class="flex a-item grey" style="margin-bottom: 10rpx">
            <input type="number" class="count_ipt" v-model="curGoods.boxNum" />
            {{ curGoods.boxUnitName }}
          </view>
          <view class="flex a-item grey">
            <input type="number" class="count_ipt" v-model="curGoods.mainNum" />
            {{ curGoods.mainUnitName }}
          </view>
        </view>
        <view class="fl2">
          <view class="th">单价</view>
          <view class="flex a-item grey" style="margin-bottom: 10rpx">
            <input type="number" class="count_ipt" v-model="curGoods.taxBoxPrice" />
          </view>
          <view class="flex a-item grey">
            <input type="number" class="count_ipt" v-model="curGoods.taxPrice" />
          </view>
        </view>

        <view class="fl1">
          <view class="th">小计</view>
          <view class="amount">￥{{ curGoods.taxBoxAmount || 0 }}元</view>
          <view class="amount">￥{{ curGoods.taxMainAmount || 0 }}元</view>
        </view>
      </view>
      <!-- <view class="goods_type flex" v-if="!disabled">
                <view class="detail type fl1" @tap="showTag = true">{{ curGoods.goodsTagName }}</view>
                <view class="detail flex" @tap="jumpDetail"><view>查看商品详情</view><img class="blue_down" src="static/image/blue_down.png"></view>
            </view> -->
    </view>
    <view class="confirm" v-if="confirmBtn" @tap="confirm"> 确认 </view>
    <!-- <keyboard class="show_key" @addGoods="addGoods" @remove="remove" @del="del" @yes="hiKey" :style="{ height: showKeyBoard ? '388rpx' : 0 }" ref="keyBoard" @num="upNum" /> -->
    <!-- <j-popup :show.sync="showTag">
      <view class="tagListBox">
        <view v-for="item in tagList" @tap="setTag(item)" class="tagItem">
          {{ item.name }}
        </view>
      </view>
    </j-popup> -->
  </view>
</template>

<script>
import Keyboard from './keyboard.vue'
import { ShoppingCartList } from '@/models/shoppingCart'
import pub from '@/common/pub'
import ProxyGoods from '../../models/proxyGoods'
import JPopup from '@/components/jPopup.vue'
import { giftPromotionDetail, paperGoodsWithEmptyBoxGoodsList } from '@/service/api/sales'
import { cartType } from '@/models/shoppingCart'
export default {
  name: 'selectGoods',
  components: { JPopup, Keyboard },
  props: {
    goods: {
      type: Object,
      default: () => {
        return {}
      },
    },
    tagList: {
      type: Array,
      default: () => [],
    },
    type: {
      type: String,
      default: 'cart',
    },
    promotion: {
      type: Object,
      default: () => {
        return {}
      },
    },
    customerId: {
      type: [String, Number],
      default: 0,
    },
    disabled: {
      type: Boolean,
      default: false,
    },
    confirmBtn: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      curGoods: {},
      showKeyBoard: false,
      curFocus: '',
      selectGoodsList: [],
      showTag: false,
      //赠品列表
      giftList: [],
      //活动商品列表
      promotionGoodsList: [],
      ruleList: [],
      tabIndex: 0,
      giveCount: '0瓶',
      cartType,
    }
  },
  watch: {
    goods(nList, oList) {
      console.log('goods=' + JSON.stringify(nList))
      this.curGoods = new ProxyGoods(nList)
    },
  },

  created() {
    console.log('goods=' + JSON.stringify(this.goods))
    this.curGoods = new ProxyGoods(this.goods)
    console.log('curGoods=' + JSON.stringify(this.curGoods))
    this.selectGoodsList = new ShoppingCartList(this.cartType[this.type])
    // if (this.promotion.promotionId) {
    //   this.getPromotionList(this.promotion.promotionId)
    // }
  },
  mounted() {
    console.log(this.goods)
    // document.querySelectorAll('.count_ipt input').forEach(item => {
    //   item.setAttribute('readonly', 'readonly')
    // })
  },
  beforeDestroy() {
    //取消订阅
    pub.$remove('changePromotion')
  },
  methods: {
    openKeyBoard(e, type) {
      if (this.disabled) return
      e.preventDefault()
      this.curFocus = type
      this.showKeyBoard = true
    },
    setCurGoods(goods) {
      this.curGoods = goods
    },
    getPromotionList(promotionId) {
      giftPromotionDetail({ customerId: this.customerId, promotionId: promotionId }).then(({ content }) => {
        this.ruleList = content.promotionInfo.detailList[0].ruleList
        const giftList = content.promotionInfo.detailList[0].giftList
        this.giftList = giftList.filter(item => item.isGift === 1)
        this.promotionGoodsList = giftList.filter(item => item.isGift === 0)
        for (let i in this.giftList) {
          const goodsTagId = this.giftList[i].goodsTagId
          const goodsTagName = this.giftList[i].goodsTagName
          const isGiftPaperBox = this.giftList[i].isGiftPaperBox
          let image
          const goods = content.goodsList.find(val => this.giftList[i].goodsId === val.goodsId)
          try {
            if (goods.imageUrl) {
              image = JSON.parse(goods.imageUrl)[0].path
            } else {
              image = 'http://129.211.211.126/download/defaultGoods.png'
            }
          } catch (e) {
            image = 'http://129.211.211.126/download/defaultGoods.png'
          }
          //必输数量
          const mustEnterNum = this.giftList[i].goodsCount
          this.$set(this.giftList, i, new ProxyGoods(Object.assign(goods, { boxNum: 0, mainNum: 0, goodsCount: 0, taxAmount: 0, noTaxAmount: 0, taxPrice: 0, noTaxPrice: 0, taxBoxPrice: 0, noTaxBoxPrice: 0, oldTaxPrice: 0, oldNoTaxPrice: 0, oldTaxBoxPrice: 0, oldNoTaxBoxPrice: 0, oldTaxAmount: 0, oldNoTaxAmount: 0, oldTax: 0, mustEnterNum, acceptTaxAmount: 0, acceptNoTaxAmount: 0, acceptTax: 0, billTaxPrice: 0, billTaxBoxPrice: 0, billTaxAmount: 0, goodsTagId, goodsTagName, isGiftPaperBox, isZeroPrice: 1, isGift: '1', promotionType: '3', isPromotion: 1, image, isPromotionAdd: 1, promotionId: this.promotion.promotionId, promotionCode: this.promotion.promotionCode, promotionName: this.promotion.promotionName })))
        }
        for (let i in this.promotionGoodsList) {
          let goodsImgUrl
          const goods = content.goodsList.find(val => this.promotionGoodsList[i].goodsId === val.goodsId)
          try {
            if (goods.imageUrl) {
              goodsImgUrl = JSON.parse(goods.imageUrl)[0].path
            } else {
              goodsImgUrl = 'http://129.211.211.126/download/defaultGoods.png'
            }
          } catch (e) {
            goodsImgUrl = 'http://129.211.211.126/download/defaultGoods.png'
          }
          const mustEnterNum = this.promotionGoodsList[i].goodsCount
          const isRequired = this.promotionGoodsList[i].isRequired
          this.$set(this.promotionGoodsList, i, new ProxyGoods(Object.assign(goods, { mustEnterNum, isRequired, boxNum: 0, mainNum: 0, goodsCount: 0, isZeroPrice: 0, isPromotion: 1, promotionType: '3', image: goodsImgUrl })))
        }
        this.curGoods = this.promotionGoodsList.find(item => item.goodsId === this.curGoods.goodsId)
      })
      //订阅变更通知
      pub.$on('changePromotion', goods => {
        this.giveCount = this.getGiftCount(goods.isGift)
      })
    },
    updateTag() {},
    confirm() {
      // this.$emit('confirm')
      this.selectGoodsList.push(this.curGoods)
      this.$emit('close')
    },
    hiKey() {
      this.curFocus = ''
      this.showKeyBoard = false
    },
    setTag(item) {
      this.curGoods.goodsTagId = item.id
      this.curGoods.goodsTagName = item.name
      this.showTag = false
      if (item.isZeroPrice) {
        this.curGoods.taxPrice = 0
      }
    },
    upNum(num) {
      if (!this.curGoods[this.curFocus]) return (this.curGoods[this.curFocus] = num)
      this.curGoods[this.curFocus] += num
    },
    remove() {
      this.curGoods[this.curFocus] = 0
    },
    del() {
      const _str = String(this.curGoods[this.curFocus])
      this.curGoods[this.curFocus] = _str.substring(0, _str.length - 1)
    },
    addGoods() {
      // if (this.promotion.promotionId) {
      //   this.addPromotionList()
      // } else {
      //   this.selectGoodsList.push(this.curGoods)
      //   this.$emit('close')
      // }
      this.selectGoodsList.push(this.curGoods)
      this.$emit('close')
    },
    checkMust() {
      let str = ''
      for (let i = 0; i < this.promotionGoodsList.length; i++) {
        if (!this.promotionGoodsList[i].isRequired) continue
        if (!(this.promotionGoodsList[i].goodsCount >= (this.promotionGoodsList[i].mustEnterNum || 1))) {
          str += `活动商品:${this.promotionGoodsList[i].goodsName}必输数量为${this.promotionGoodsList[i].mustEnterNum};`
        }
      }
      for (let i = 0; i < this.giftList.length; i++) {
        if (this.giftList[i].goodsCount < this.giftList[i].mustEnterNum) str += `赠品:${this.giftList[i].goodsName}必输数量为${this.giftList[i].mustEnterNum};`
      }
      if (str) uni.showModal({ title: '提示', content: str })
      return str
    },
    addPromotionList() {
      //检查必输箱数
      if (!this.checkMust()) {
        return
      }
      const promotionGoodsList = this.promotionGoodsList.filter(item => item.goodsCount > 0)
      //获取活动商品箱数
      let promotionBoxCount = 0
      //获取赠品数量
      let promotionCount = 0
      promotionGoodsList.forEach(item => {
        promotionCount += Number(item.goodsCount)
        promotionBoxCount += Number(item.boxNum)
      })
      const giftList = this.giftList.filter(item => item.goodsCount > 0)
      //获取赠品箱数
      let giftBoxCount = 0
      //获取赠品数量
      let giftCount = 0
      giftList.forEach(item => {
        giftCount += Number(item.goodsCount)
        giftBoxCount += Number(item.boxNum)
      })
      if (giftCount === 0) {
        this.selectGoodsList.push(promotionGoodsList)
        this.$emit('close')
        return
      }
      //判断活动商品满赠类型
      if (this.ruleList[0].reachType === 2) {
        //阶梯过滤出当前促销符合的条件
        const satisfyList = this.ruleList.filter(item => item.full <= promotionCount)
        //查询最大符合条件
        let satisfy = null
        satisfyList.forEach(item => {
          if (!satisfy || item.full > satisfy.full) {
            satisfy = item
          }
        })
        //符合促销
        if (satisfy) {
          //计算最大满足倍数
          const promotionNum = parseInt(promotionCount / satisfy.full)
          //计算最大赠送赠品数量
          const giftNum = promotionNum * satisfy.result
          //判断当前赠品数量是否超最大可赠送数量
          //判断赠品类型
          if (satisfy.resultType === 2) {
            if (giftCount > giftNum) {
              uni.showToast({ title: `当前赠品数量大于可赠送数量，不允许下单;可赠数量为${giftNum}瓶，当前赠送数量为${giftCount}瓶`, icon: 'none' })
            } else {
              this.submitPromotionList()
            }
          } else if (satisfy.resultType === 3) {
            //判断当前赠品数量是否超最大可赠送数量
            const mainGift = this.giftList.find(item => item.mainNum > 0)
            if (mainGift) {
              uni.showToast({ title: '赠送规格为箱,不允许输入零数', icon: 'none' })
              return
            }
            if (giftBoxCount > giftNum) {
              uni.showToast({ title: `当前赠品数量大于可赠送数量，不允许下单;可赠数量为${giftNum}箱，当前赠送数量为${giftBoxCount}箱`, icon: 'none' })
            } else {
              this.submitPromotionList()
            }
          } else {
            const goodsList = this.promotionGoodsList.filter(item => item.goodsCount > 0)
            goodsList.forEach(item => {
              item.promotionGroupKey = null
              item.remark = item.giftRemark
              this.selectGoodsList.push(item)
            })
            this.$emit('close')
          }
        }
      } else if (this.ruleList[0].reachType === 3) {
        //阶梯过滤出当前促销符合的条件
        const satisfyList = this.ruleList.filter(item => item.full <= promotionBoxCount)
        //查询最大符合条件
        let satisfy = null
        satisfyList.forEach(item => {
          if (!satisfy || item.full > satisfy.full) {
            satisfy = item
          }
        })
        //符合促销
        if (satisfy) {
          //计算最大满足倍数
          const promotionNum = parseInt(promotionBoxCount / satisfy.full)
          //计算最大赠送赠品数量
          const giftNum = promotionNum * satisfy.result
          console.log(`活动商品箱数${promotionBoxCount},满促条件${satisfy.full},单词满足可赠为${promotionNum},满足可赠箱数${giftNum}`)
          //判断当前赠品数量是否超最大可赠送数量
          //判断赠品类型
          if (satisfy.resultType === 2) {
            if (giftCount > giftNum) {
              uni.showToast({ title: `当前赠品数量大于可赠送数量，不允许下单;可赠数量为${giftNum}瓶，当前赠送数量为${giftCount}瓶`, icon: 'none' })
            } else {
              this.submitPromotionList()
            }
          } else if (satisfy.resultType === 3) {
            //判断当前赠品数量是否超最大可赠送数量
            const mainGift = this.giftList.find(item => item.mainNum > 0)
            if (mainGift) {
              uni.showToast({ title: '赠送规格为箱,不允许输入零数', icon: 'none' })
              return
            }
            if (giftBoxCount > giftNum) {
              uni.showToast({ title: `当前赠品数量大于可赠送数量，不允许下单;可赠数量为${giftNum}箱，当前赠送数量为${giftBoxCount}箱`, icon: 'none' })
            } else {
              this.submitPromotionList()
            }
          }
        } else {
          // uni.showToast({title: '当前活动商品数量不满足促销条件', icon: 'none'})
          const goodsList = this.promotionGoodsList.filter(item => item.goodsCount > 0)
          goodsList.forEach(item => {
            item.promotionGroupKey = null
            item.remark = item.giftRemark
            this.selectGoodsList.push(item)
          })
          this.$emit('close')
        }
      }
    },
    async submitPromotionList() {
      const date = new Date().getTime()
      const giftList = this.giftList.filter(item => item.goodsCount > 0)
      const giftEmptyBoxList = giftList.filter(item => item.packageType == 1 && item.isGiftPaperBox == 0)
      const goodsIds = giftEmptyBoxList.map(item => item.goodsId).join(',')
      const promotionList = this.promotionGoodsList.filter(item => item.goodsCount > 0)
      // const emptyBoxList = []
      if (goodsIds) {
        const res = await paperGoodsWithEmptyBoxGoodsList({ ids: goodsIds, customerId: this.customerId })
        const content = res.content
        for (let i of content) {
          const gift = this.giftList.find(item => item.goodsId === i.id)
          if (!gift) {
            continue
          }
          let uuid
          // = uuidv4().split('-')
          uuid = `${new Date().getTime()}${gift.goodsId}`
          const emptyBox = i.paperEmptyBoxGoodsInfo
          if (!emptyBox) {
            continue
          }
          emptyBox.boxNum = Number(gift.boxNum)
          emptyBox.mainNum = 0
          emptyBox.goodsCount = emptyBox.boxNum * Number(emptyBox.boxUnitCount)
          emptyBox.taxAmount = emptyBox.goodsCount * emptyBox.taxPrice
          emptyBox.billTaxAmount = emptyBox.billTaxPrice * emptyBox.goodsCount
          emptyBox.boxCount = emptyBox.boxNum
          emptyBox.isEmptyBoxAdd = '1'
          emptyBox.isPromotionAdd = 1
          emptyBox.remark = this.remark
          gift.promotionEmptyBoxKey = uuid
          emptyBox.promotionEmptyBoxKey = uuid
          const index = this.giftList.indexOf(gift)
          giftList.splice(index + 1, 0, emptyBox)
          // emptyBoxList.push(emptyBox)
        }
      }
      const promotionGoodsList = [...this.promotionGoodsList.filter(item => item.goodsCount > 0), ...giftList]
      for (let i of promotionGoodsList) {
        i.promotionGroupKey = date
        i.remark = this.remark
        i.isPromotion = 1
        i.promotionId = i.isEmptyBoxAdd ? null : this.promotionId
        i.acceptBoxNum = i.boxNum
        i.isOne = 0
        i.acceptMainNum = i.mainNum
        i.promotionCode = i.isEmptyBoxAdd ? null : this.promotionCode
        i.promotionName = i.isEmptyBoxAdd ? null : this.promotionName
        i.sourceDetailType = i.isEmptyBoxAdd ? '1' : '2'
      }
      if (promotionList.length === 1 && giftList.filter(item => item.isEmptyBoxAdd !== '1').length === 1) {
        const promotionGoods = promotionGoodsList[0]
        promotionGoods.promotionData = {}
        promotionGoods.promotionData.gift = promotionGoodsList[1]
        promotionGoods.promotionData.ruleList = this.ruleList
        promotionGoods.isOne = 1
        promotionGoods.promotionData.emptyBox = promotionGoodsList[2]
        promotionGoods.promotionData = JSON.stringify(promotionList[0].promotionData)
      }
      // this.hideModal = false
      this.selectGoodsList.push(promotionGoodsList)
      this.$emit('close')
    },
    jumpDetail() {
      uni.navigateTo({
        url: '/pages/shopping/detail',
      })
      //设置接收回调
      pub.$send('curGoods', this.curGoods)
    },
    getGiftCount(isGift) {
      if (!this.promotionGoodsList) {
        return
      }
      const promotionGoodsList = this.promotionGoodsList.filter(item => item.goodsCount > 0)
      //获取活动商品箱数
      let promotionBoxCount = 0
      //获取赠品数量
      let promotionCount = 0
      promotionGoodsList.forEach(item => {
        promotionCount += Number(item.goodsCount)
        promotionBoxCount += Number(item.boxNum)
      })
      const giftList = this.giftList.filter(item => item.goodsCount > 0)
      //获取赠品箱数
      let giftBoxCount = 0
      //获取赠品数量
      let giftCount = 0
      giftList.forEach(item => {
        giftCount += Number(item.goodsCount)
        giftBoxCount += Number(item.boxNum)
      })

      //判断活动商品满赠类型
      if (this.ruleList[0].reachType === 2) {
        //阶梯过滤出当前促销符合的条件
        const satisfyList = this.ruleList.filter(item => item.full <= promotionCount)
        //查询最大符合条件
        let satisfy = null
        satisfyList.forEach(item => {
          if (!satisfy || item.full > satisfy.full) {
            satisfy = item
          }
        })
        //符合促销
        if (satisfy) {
          //计算最大满足倍数
          const promotionNum = parseInt(promotionCount / satisfy.full)
          //计算最大赠送赠品数量
          let giftNum = promotionNum * satisfy.result
          //判断当前赠品数量是否超最大可赠送数量
          if (this.giftList.length === 1 && !isGift) {
            if (satisfy.resultType === 2) {
              this.giftList[0].goodsCount = giftNum
              const boxCount = parseInt(Number(this.giftList[0].goodsCount) / Number(this.giftList[0].boxUnitCount))
              this.giftList[0].mainNum = Number(this.giftList[0].goodsCount) % Number(this.giftList[0].goodsCount.boxUnitCount)
              this.giftList[0].boxNum = boxCount
              console.log(this.giftList[0])
            } else {
              this.giftList[0].goodsCount = giftNum * this.giftList[0].boxUnitCount
              this.giftList[0].mainNum = 0
              this.giftList[0].boxNum = giftNum
            }
            return `0${satisfy.resultType === 2 ? '瓶' : '箱'}`
          }
          return `${giftNum - (satisfy.resultType === 2 ? giftCount : giftBoxCount)}${satisfy.resultType === 2 ? '瓶' : '箱'}`
        } else {
          return '0瓶'
        }
      } else if (this.ruleList[0].reachType === 3) {
        //阶梯过滤出当前促销符合的条件
        const satisfyList = this.ruleList.filter(item => item.full <= promotionBoxCount)
        //查询最大符合条件
        let satisfy = null
        satisfyList.forEach(item => {
          if (!satisfy || item.full > satisfy.full) {
            satisfy = item
          }
        })
        //符合促销
        if (satisfy) {
          //计算最大满足倍数
          const promotionNum = parseInt(promotionBoxCount / satisfy.full)
          //计算最大赠送赠品数量
          let giftNum = promotionNum * satisfy.result
          console.log(`活动商品箱数${promotionBoxCount},满促条件${satisfy.full},单次满足可赠为${promotionNum},满足可赠箱数${giftNum}`)
          //判断当前赠品数量是否超最大可赠送数量
          //判断赠品类型
          if (this.giftList.length === 1 && !isGift) {
            if (satisfy.resultType === 2) {
              this.giftList[0].goodsCount = giftNum
              const boxCount = parseInt(Number(this.giftList[0].goodsCount) / Number(this.giftList[0].boxUnitCount))
              this.giftList[0].mainNum = Number(this.giftList[0].goodsCount) % Number(this.giftList[0].goodsCount.boxUnitCount)
              this.giftList[0].boxNum = boxCount
            } else {
              this.giftList[0].goodsCount = giftNum * this.giftList[0].boxUnitCount
              this.giftList[0].mainNum = 0
              this.giftList[0].boxNum = giftNum
              console.log(this.giftList[0])
            }
            return `0${satisfy.resultType === 2 ? '瓶' : '箱'}`
          }
          return `${giftNum - (satisfy.resultType === 2 ? giftCount : giftBoxCount)}${satisfy.resultType === 2 ? '瓶' : '箱'}`
        } else {
          return '0瓶'
        }
      }
    },
  },
}
</script>

<style scoped lang="scss">
.container {
  width: 100vw;
}
.goods_main {
  padding: 30rpx;
  .img_box {
    img {
      width: 179rpx;
      height: 179rpx;
    }
  }
  .goods_info {
    margin-left: 10rpx;
    .goodsName {
      font-size: 32rpx;
      font-weight: 500;
      height: 90rpx;
      color: #333333;
    }
    .box_price {
      font-size: 28rpx;
      font-weight: 400;
      color: #999999;
      margin-bottom: 10rpx;
    }
  }
  .goods_amount_box {
    margin-top: 50rpx;
    font-size: 28rpx;
    .th {
      font-size: 28rpx;
      font-weight: 400;
      color: #999999;
    }
    .count_ipt {
      width: 203rpx;
      height: 60rpx;
      background: #f6f8fb;
      border-radius: 10rpx;
      border: 1rpx solid #c3cbd7;
      text-align: center;
    }
    .price {
      font-size: 28rpx;
      font-weight: 500;
      color: #666666;
      height: 70rpx;
      display: flex;
      align-items: center;
    }
    .amount {
      font-size: 28rpx;
      font-weight: 500;
      color: #fb2121;
      height: 70rpx;
      display: flex;
      align-items: center;
    }
  }
  .goods_type {
    border-top: 2rpx solid #eff3f9;
    height: 150rpx;
    margin-top: 30rpx;
    padding-top: 35rpx;
  }
  .type {
    font-size: 32rpx;
    color: #333333;
    &:before {
      content: '商品类型: ';
      color: #999999;
    }
  }
  .detail {
    font-weight: 600;
    color: #016ef9;
    font-size: 32rpx;
    .blue_down {
      width: 36rpx;
      height: 40rpx;
      margin-top: 5rpx;
    }
  }
}
.show_key {
  transition: height 0.2s;
}
.focusIpt {
  border: 1rpx red solid !important;
}
.tagListBox {
  padding: 30rpx;
  min-height: 520rpx;
  height: 200rpx;
  overflow: auto;
  .tagItem {
    font-size: 40rpx;
    margin-bottom: 20rpx;
  }
}
.promotion_box {
  background: white;
  width: 690rpx;
  height: 300rpx;
  border-radius: 30rpx 30rpx 0 0;
  padding: 30rpx;
  .tab {
    width: 200rpx;
    height: 50rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1rpx solid #999;
  }
  .selectTab {
    background: #999;
  }
  .promotion_name {
    color: #ffb509;
    font-size: 30rpx;
    font-weight: 600;
    justify-content: right;
  }
  .promotion_container {
    overflow-y: auto;
    height: 240rpx;
    .curGoods {
      background: #ff9c9c !important;
    }
    .activity_goods {
      background: #f6f6f6;
      color: #666666;
      font-size: 30rpx;
      padding: 20rpx;
      margin-top: 5rpx;
      .goods_name {
        flex: 1;
      }
      .goods_num {
        min-width: 100rpx;
        color: blue;
      }
    }
  }
  .giveCount {
    color: red;
    height: 50rpx;
  }
}
.confirm {
  width: 600rpx;
  height: 70rpx;
  background: #016ef9;
  color: white;
  font-size: 30rpx;
  text-align: center;
  line-height: 50rpx;
  margin: 20rpx auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50rpx;
}
</style>
